﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;

namespace DataEntities
{
    [Table(Name = "dbo.TuiHuanInfo")]
    public partial class TuiHuanInfo : Entity
    {

        private int _iTHDId;

        private int _iCarid;

        private int _iKeHuId;

        private int _iCZDId;

        private DateTime _tStartDate;

        private DateTime _tEndDate;

        private DateTime _tJSRQ;

        private int _iCZDays;

        private int _iXZDays;

        private double _dXuZuSF;

        private double _dYuFuJE;

        private double _dYaJing;

        private double _dYouHui;

        private double _dRiFu;

        private double _dYingFu;

        private double _dShiFu;

        private double _dWZ;

        private double _dYS;

        private double _dYT;

        private string _sMore;

        private Binary _imgKC;

        private bool _bTHZF;

        private EntityRef<CarInfo> _CarInfo;

        private EntityRef<ChuZuInfo> _ChuZuInfo;

        private EntityRef<KeHuInfo> _KeHuInfo;

        public TuiHuanInfo()
        {
            this._CarInfo = default(EntityRef<CarInfo>);
            this._ChuZuInfo = default(EntityRef<ChuZuInfo>);
            this._KeHuInfo = default(EntityRef<KeHuInfo>);
        }

        [Column(Storage = "_iTHDId", AutoSync = AutoSync.OnInsert, DbType = "Int NOT NULL IDENTITY", IsPrimaryKey = true, IsDbGenerated = true)]
        public int iTHDId
        {
            get
            {
                return this._iTHDId;
            }
            set
            {
                if ((this._iTHDId != value))
                {
                    this.SendPropertyChanging("iTHDId");
                    this._iTHDId = value;
                    this.SendPropertyChanged("iTHDId",value);
                }
            }
        }

        [Column(Storage = "_iCarid", DbType = "Int")]
        public int iCarid
        {
            get
            {
                return this._iCarid;
            }
            set
            {
                if ((this._iCarid != value))
                {
                    if (this._CarInfo.HasLoadedOrAssignedValue)
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.SendPropertyChanging("iCarid");
                    this._iCarid = value;
                    this.SendPropertyChanged("iCarid",value);
                }
            }
        }

        [Column(Storage = "_iKeHuId", DbType = "Int")]
        public int iKeHuId
        {
            get
            {
                return this._iKeHuId;
            }
            set
            {
                if ((this._iKeHuId != value))
                {
                    if (this._KeHuInfo.HasLoadedOrAssignedValue)
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.SendPropertyChanging("iKeHuId");
                    this._iKeHuId = value;
                    this.SendPropertyChanged("iKeHuId",value);
                }
            }
        }

        [Column(Storage = "_iCZDId", DbType = "Int")]
        public int iCZDId
        {
            get
            {
                return this._iCZDId;
            }
            set
            {
                if ((this._iCZDId != value))
                {
                    if (this._ChuZuInfo.HasLoadedOrAssignedValue)
                    {
                        throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException();
                    }
                    this.SendPropertyChanging("iCZDId");
                    this._iCZDId = value;
                    this.SendPropertyChanged("iCZDId",value);
                }
            }
        }

        [Column(Storage = "_tStartDate", DbType = "DateTime")]
        public DateTime tStartDate
        {
            get
            {
                return this._tStartDate;
            }
            set
            {
                if ((this._tStartDate != value))
                {
                    this.SendPropertyChanging("tStartDate");
                    this._tStartDate = value;
                    this.SendPropertyChanged("tStartDate",value);
                }
            }
        }

        [Column(Storage = "_tEndDate", DbType = "DateTime")]
        public DateTime tEndDate
        {
            get
            {
                return this._tEndDate;
            }
            set
            {
                if ((this._tEndDate != value))
                {
                    this.SendPropertyChanging("tEndDate");
                    this._tEndDate = value;
                    this.SendPropertyChanged("tEndDate",value);
                }
            }
        }

        [Column(Storage = "_tJSRQ", DbType = "DateTime")]
        public DateTime tJSRQ
        {
            get
            {
                return this._tJSRQ;
            }
            set
            {
                if ((this._tJSRQ != value))
                {
                    this.SendPropertyChanging("tJSRQ");
                    this._tJSRQ = value;
                    this.SendPropertyChanged("tJSRQ",value);
                }
            }
        }

        [Column(Storage = "_iCZDays", DbType = "Int")]
        public int iCZDays
        {
            get
            {
                return this._iCZDays;
            }
            set
            {
                if ((this._iCZDays != value))
                {
                    this.SendPropertyChanging("iCZDays");
                    this._iCZDays = value;
                    this.SendPropertyChanged("iCZDays",value);
                }
            }
        }

        [Column(Storage = "_iXZDays", DbType = "Int")]
        public int iXZDays
        {
            get
            {
                return this._iXZDays;
            }
            set
            {
                if ((this._iXZDays != value))
                {
                    this.SendPropertyChanging("iXZDays");
                    this._iXZDays = value;
                    this.SendPropertyChanged("iXZDays",value);
                }
            }
        }

        [Column(Storage = "_dXuZuSF", DbType = "Float")]
        public double dXuZuSF
        {
            get
            {
                return this._dXuZuSF;
            }
            set
            {
                if ((this._dXuZuSF != value))
                {
                    this.SendPropertyChanging("dXuZuSF");
                    this._dXuZuSF = value;
                    this.SendPropertyChanged("dXuZuSF", value);
                }
            }
        }

        [Column(Storage = "_dYuFuJE", DbType = "Float")]
        public double dYuFuJE
        {
            get
            {
                return this._dYuFuJE;
            }
            set
            {
                if ((this._dYuFuJE != value))
                {
                    this.SendPropertyChanging("dYuFuJE");
                    this._dYuFuJE = value;
                    this.SendPropertyChanged("dYuFuJE",value);
                }
            }
        }

        [Column(Storage = "_dYaJing", DbType = "Float")]
        public double dYaJing
        {
            get
            {
                return this._dYaJing;
            }
            set
            {
                if ((this._dYaJing != value))
                {
                    this.SendPropertyChanging("dYaJing");
                    this._dYaJing = value;
                    this.SendPropertyChanged("dYaJing",value);
                }
            }
        }

        [Column(Storage = "_dYouHui", DbType = "Float")]
        public double dYouHui
        {
            get
            {
                return this._dYouHui;
            }
            set
            {
                if ((this._dYouHui != value))
                {
                    this.SendPropertyChanging("dYouHui");
                    this._dYouHui = value;
                    this.SendPropertyChanged("dYouHui",value);
                }
            }
        }

        [Column(Storage = "_dRiFu", DbType = "Float")]
        public double dRiFu
        {
            get
            {
                return this._dRiFu;
            }
            set
            {
                if ((this._dRiFu != value))
                {
                    this.SendPropertyChanging("dRiFu");
                    this._dRiFu = value;
                    this.SendPropertyChanged("dRiFu",value);
                }
            }
        }

        [Column(Storage = "_dYingFu", DbType = "Float")]
        public double dYingFu
        {
            get
            {
                return this._dYingFu;
            }
            set
            {
                if ((this._dYingFu != value))
                {
                    this.SendPropertyChanging("dYingFu");
                    this._dYingFu = value;
                    this.SendPropertyChanged("dYingFu",value);
                }
            }
        }

        [Column(Storage = "_dShiFu", DbType = "Float")]
        public double dShiFu
        {
            get
            {
                return this._dShiFu;
            }
            set
            {
                if ((this._dShiFu != value))
                {
                    this.SendPropertyChanging("dShiFu");
                    this._dShiFu = value;
                    this.SendPropertyChanged("dShiFu",value);
                }
            }
        }

        [Column(Storage = "_dWZ", DbType = "Float")]
        public double dWZ
        {
            get
            {
                return this._dWZ;
            }
            set
            {
                if ((this._dWZ != value))
                {
                    this.SendPropertyChanging("dWZ");
                    this._dWZ = value;
                    this.SendPropertyChanged("dWZ",value);
                }
            }
        }

        [Column(Storage = "_dYS", DbType = "Float")]
        public double dYS
        {
            get
            {
                return this._dYS;
            }
            set
            {
                if ((this._dYS != value))
                {
                    this.SendPropertyChanging("dYS");
                    this._dYS = value;
                    this.SendPropertyChanged("dYS",value);
                }
            }
        }

        [Column(Storage = "_dYT", DbType = "Float")]
        public double dYT
        {
            get
            {
                return this._dYT;
            }
            set
            {
                if ((this._dYT != value))
                {
                    this.SendPropertyChanging("dYT");
                    this._dYT = value;
                    this.SendPropertyChanged("dYT",value);
                }
            }
        }

        [Column(Storage = "_sMore", DbType = "VarChar(500)")]
        public string sMore
        {
            get
            {
                return this._sMore;
            }
            set
            {
                if ((this._sMore != value))
                {
                    this.SendPropertyChanging("sMore");
                    this._sMore = value;
                    this.SendPropertyChanged("sMore",value);
                }
            }
        }

        [Column(Storage = "_imgKC", DbType = "Image", CanBeNull = true, UpdateCheck = UpdateCheck.Never)]
        public System.Data.Linq.Binary imgKC
        {
            get
            {
                return this._imgKC;
            }
            set
            {
                if ((this._imgKC != value))
                {
                    this.SendPropertyChanging("imgKC");
                    this._imgKC = value;
                    this.SendPropertyChanged("imgKC",value);
                }
            }
        }

        [Column(Storage = "_bTHZF", DbType = "Bit")]
        public bool bTHZF
        {
            get
            {
                return this._bTHZF;
            }
            set
            {
                if ((this._bTHZF != value))
                {
                    this.SendPropertyChanging("bTHZF");
                    this._bTHZF = value;
                    this.SendPropertyChanged("bTHZF",value);
                }
            }
        }

        [Association(Name = "CarInfo_TuiHuanInfo", Storage = "_CarInfo", ThisKey = "iCarid", OtherKey = "iCarid", IsForeignKey = true)]
        public CarInfo CarInfo
        {
            get
            {
                return this._CarInfo.Entity;
            }
            set
            {
                CarInfo previousValue = this._CarInfo.Entity;
                if (((previousValue != value)
                            || (this._CarInfo.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging("CarInfo");
                    if ((previousValue != null))
                    {
                        this._CarInfo.Entity = null;
                        previousValue.TuiHuanInfo.Remove(this);
                    }
                    this._CarInfo.Entity = value;
                    if ((value != null))
                    {
                        value.TuiHuanInfo.Add(this);
                        this._iCarid = value.iCarid;
                    }
                    else
                    {
                        this._iCarid = default(int);
                    }
                    this.SendPropertyChanged("CarInfo",value);
                }
            }
        }

        [Association(Name = "ChuZuInfo_TuiHuanInfo", Storage = "_ChuZuInfo", ThisKey = "iCZDId", OtherKey = "iCZDId", IsForeignKey = true)]
        public ChuZuInfo ChuZuInfo
        {
            get
            {
                return this._ChuZuInfo.Entity;
            }
            set
            {
                ChuZuInfo previousValue = this._ChuZuInfo.Entity;
                if (((previousValue != value)
                            || (this._ChuZuInfo.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging("ChuZuInfo");
                    if ((previousValue != null))
                    {
                        this._ChuZuInfo.Entity = null;
                        previousValue.TuiHuanInfo.Remove(this);
                    }
                    this._ChuZuInfo.Entity = value;
                    if ((value != null))
                    {
                        value.TuiHuanInfo.Add(this);
                        this._iCZDId = value.iCZDId;
                    }
                    else
                    {
                        this._iCZDId = default(int);
                    }
                    this.SendPropertyChanged("ChuZuInfo",value);
                }
            }
        }

        [Association(Name = "KeHuInfo_TuiHuanInfo", Storage = "_KeHuInfo", ThisKey = "iKeHuId", OtherKey = "iKeHuId", IsForeignKey = true)]
        public KeHuInfo KeHuInfo
        {
            get
            {
                return this._KeHuInfo.Entity;
            }
            set
            {
                KeHuInfo previousValue = this._KeHuInfo.Entity;
                if (((previousValue != value)
                            || (this._KeHuInfo.HasLoadedOrAssignedValue == false)))
                {
                    this.SendPropertyChanging("KeHuInfo");
                    if ((previousValue != null))
                    {
                        this._KeHuInfo.Entity = null;
                        previousValue.TuiHuanInfo.Remove(this);
                    }
                    this._KeHuInfo.Entity = value;
                    if ((value != null))
                    {
                        value.TuiHuanInfo.Add(this);
                        this._iKeHuId = value.iKeHuId;
                    }
                    else
                    {
                        this._iKeHuId = default(int);
                    }
                    this.SendPropertyChanged("KeHuInfo",value);
                }
            }
        }
    }
}
